package com.sanploy.manage.service.impl;

import com.sanploy.common.domain.Banner;
import com.sanploy.common.domain.dto.BannerDto;
import com.sanploy.common.util.CommonUtil;
import com.sanploy.manage.mapper.BannerMapper;
import com.sanploy.manage.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zhu yingzhi on 2017/10/12.
 * @author yingzhi zhu
 * 后台轮播图 逻辑处理实现类
 */
@Service
public class BannerServiceImpl implements BannerService {
    @Autowired
    private BannerMapper bannerMapper;
    @Override
    public int addBanner(BannerDto bannerDto) {
        bannerDto.setAdd_time(CommonUtil.getTimeNormal());
        return bannerMapper.addBanner(bannerDto);
    }

    @Override
    public int editBanner(Banner banner) {
        return bannerMapper.editBanner(banner);
    }

    @Override
    public List<Banner> findAllBanner() {
        return bannerMapper.findAllBanner();
    }

    @Override
    public Banner findById(Long id) {
        return bannerMapper.findById(id);
    }

    @Override
    public int deleteBanner(Long id) {
        return bannerMapper.deleteBanner(id);
    }
}
